

package com.hexinfo.dmpro.script.config.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hexinfo.dmpro.common.annotation.AnonymousAccess;
import org.springframework.http.ResponseEntity;
import com.hexinfo.dmpro.script.config.model.ConfigPropertyPublishuser;
import com.hexinfo.dmpro.script.config.service.ConfigPropertyPublishuserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * 发布用户表
 *
 * @author zl
 * @date 2024-02-05 10:05:15
 */
@RestController
@AllArgsConstructor
@RequestMapping("/api/configpropertypublishuser" )
@Api(value = "configpropertypublishuser", tags = "发布用户表管理")
public class ConfigPropertyPublishuserController {

    private final  ConfigPropertyPublishuserService configPropertyPublishuserService;

    /**
     * 分页查询
     * @param page 分页对象
     * @param configPropertyPublishuser 发布用户表
     * WrapperEnhancer.like(configPropertyPublishuser); //自动拼接存在值sql的方法
     * @return
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @GetMapping("/page" )
    @AnonymousAccess
    public ResponseEntity<Object> getConfigPropertyPublishuserPage(Page page, ConfigPropertyPublishuser configPropertyPublishuser) {
        return ResponseEntity.ok(configPropertyPublishuserService.queryList(page,configPropertyPublishuser));
    }
    //不分页查询
    @ApiOperation(value = "不分页查询", notes = "不分页查询")
    @GetMapping("/list" )
    @AnonymousAccess
    public ResponseEntity<Object> getPublishuserSet(ConfigPropertyPublishuser configPropertyPublishuser) {
        return ResponseEntity.ok(configPropertyPublishuserService.queryListNoPage(configPropertyPublishuser));
    }


    /**
     * 通过id查询发布用户表
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id查询", notes = "通过id查询")
    @GetMapping("/{id}" )
    @AnonymousAccess
    public ResponseEntity<Object> getById(@PathVariable("id" ) String id) {
        return ResponseEntity.ok(configPropertyPublishuserService.getById(id));
    }

    /**
     * 新增发布用户表
     * @param configPropertyPublishuser 发布用户表
     * @return R
     */
    @ApiOperation(value = "新增发布用户表", notes = "新增发布用户表")
    @PostMapping
    @AnonymousAccess
    public ResponseEntity<Object> save(@RequestBody ConfigPropertyPublishuser configPropertyPublishuser) {
        return ResponseEntity.ok(configPropertyPublishuserService.save(configPropertyPublishuser));
    }

    /**
     * 修改发布用户表
     * @param configPropertyPublishuser 发布用户表
     * @return R
     */
    @ApiOperation(value = "修改发布用户表", notes = "修改发布用户表")
    @PutMapping
    @AnonymousAccess
    public ResponseEntity<Object> updateById(@RequestBody ConfigPropertyPublishuser configPropertyPublishuser) {
        return ResponseEntity.ok(configPropertyPublishuserService.updateById(configPropertyPublishuser));
    }

    /**
     * 通过id删除发布用户表
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id删除发布用户表", notes = "通过id删除发布用户表")
    @DeleteMapping("/{id}" )
    @AnonymousAccess
    public ResponseEntity<Object> removeById(@PathVariable String id) {
        return ResponseEntity.ok(configPropertyPublishuserService.removeById(id));
    }

}
